package com.yuanxin.chat.controller;

import java.util.List;

import javax.annotation.Resource;
import javax.servlet.http.HttpSession;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.servlet.ModelAndView;

import com.yuanxin.chat.pojo.Log;
import com.yuanxin.chat.service.ILogService;

/**
 * Author : Amayadream Date : 2016.01.10 00:23 TODO :
 */
@Controller
public class LogController {
	@Resource
	private Log log;
	@Resource
	private ILogService logService;

	@RequestMapping(value = "/log.do")
	public ModelAndView selectAll(HttpSession session, @RequestParam(defaultValue = "1") int page) {
		String userid = (String) session.getAttribute("userid");
		int pageSize = 10;
		ModelAndView view = new ModelAndView("log");
		List<Log> list = logService.selectLogByUserid(userid, page, pageSize);
		int count = logService.selectCountByUserid(userid, pageSize);
		view.addObject("list", list);
		view.addObject("count", count);
		return view;
	}

}










